//
//  NSTimer+TimerBlock.m
//  NeicunTest
//
//  Created by tanqilong on 16/5/24.
//  Copyright © 2016年 tanqilong. All rights reserved.
//

#import "NSTimer+TimerBlock.h"

@implementation NSTimer (TimerBlock)

+(NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti TimerDo:(void (^)())timerBlock {
    NSTimer * timer = [NSTimer scheduledTimerWithTimeInterval:ti target:self selector:@selector(timerBlcokDo:) userInfo:[timerBlock copy] repeats:YES];
    return timer;
}

+(void)timerBlcokDo:(NSTimer *)timer {
    void(^timerBlock)() = timer.userInfo;
    if (timerBlock) {
         timerBlock();
    }
}

@end
